package compostie.pattern.demo;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 逸足天涯 on 10/19/2019.
 */
public class Teacher implements ITeacher {
    private String teahcerName;
    private String deptName;
    private List<ITeacher> controls;

    public Teacher(String teahcerName, String deptName) {
        this.teahcerName = teahcerName;
        this.deptName = deptName;
        controls = new ArrayList<ITeacher>();
    }
    //添加教师
    public void add(Teacher teacher){
        controls.add(teacher);
    }
    //移除教师
    public void remove(Teacher teacher){
        controls.remove(teacher);
    }

    public List<ITeacher> getControllingDepts(){
        return controls;
    }
    @Override
    public String getDetails() {
        return (teahcerName + " is the " + deptName);
    }
}
